package cn.mw.cmdb.link.entity;

import cn.mw.cmdb.entity.DataAuth;
import cn.mw.cmdb.entity.PropertyTypeString;
import cn.mw.components.mongodb.anno.AutoId;
import cn.mw.components.mongodb.anno.CMDBProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;

/**
 * @author gengjb
 * @description 线路树结构实体
 * @date 2024/8/27 11:54
 */
@Getter
@Setter
@Schema(name = "MwLinkTreeDto", description = "线路树结构实体")
@Document("mw_cmdbmd_link_tree")
public class MwLinkTreeDto extends DataAuth {

    @Schema(description = "主键")
    @CMDBProperty(searchType = PropertyTypeString.ID, searchPrefix = "_", isShow = true)
    @AutoId
    private String id;

    @Schema(description = "父节点ID")
    @CMDBProperty(searchType = PropertyTypeString.ID ,keywordSearch = true)
    private String parentId;

    @Schema(description = "树结构名称")
    @CMDBProperty(searchType = PropertyTypeString.ID ,keywordSearch = true)
    private String linkTreeName;

    @Schema(description = "所属线路ID集合")
    @Transient
    private List<String> linkIds;

    @Schema(description = "所属线路ID集合")
    @Transient
    private Integer linkCount = 0;

    @Schema(description = "子目录")
    @Transient
    private List<MwLinkTreeDto> children;
}
